package com.nbsaas.boot.marketing.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.time.LocalDateTime;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "用户优惠券", model = "用户优惠券")
@Entity
@Table(name = "bs_user_coupon")
@Comment("用户优惠券表")
public class UserCoupon extends AbstractEntity {

    @Comment("用户ID")
    @SearchItem(name = "userId", key = "userId", label = "用户ID")
    @FormField(title = "用户ID", sortNum = "1", grid = true, required = true)
    @Column(nullable = false)
    private Long userId;

    @Comment("优惠券ID")
    @SearchItem(name = "couponId", key = "couponId", label = "优惠券ID")
    @FormField(title = "优惠券ID", sortNum = "2", grid = true, required = true)
    @Column(nullable = false)
    private Long couponId;

    @Comment("优惠券码")
    @SearchItem(name = "code", key = "code", label = "优惠券码")
    @FormField(title = "优惠券码", sortNum = "3", grid = true)
    @Column(length = 50)
    private String code;

    @Comment("状态")
    @SearchItem(name = "status", key = "status", label = "状态")
    @FormField(title = "状态", sortNum = "4", grid = true, type = InputType.select, option = "user_coupon_status")
    @Column(length = 20)
    private String status;

    @Comment("领取时间")
    @FormField(title = "领取时间", sortNum = "5", grid = true, type = InputType.date)
    private LocalDateTime getTime;

    @Comment("使用时间")
    @FormField(title = "使用时间", sortNum = "6", grid = true, type = InputType.date)
    private LocalDateTime useTime;

    @Comment("使用订单ID")
    @FormField(title = "使用订单ID", sortNum = "7", grid = true)
    private Long orderId;

    @Comment("过期时间")
    @FormField(title = "过期时间", sortNum = "8", grid = true, type = InputType.date)
    private LocalDateTime expireTime;
} 